package com.wanxi.newstype.controller;


import com.wanxi.common.entity.NewsTypeModel;
import com.wanxi.common.result.ResultDTO;
import com.wanxi.newstype.service.impl.NewsTypeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class NewsTypeController {


    @Autowired
    private NewsTypeServiceImpl newsTypeService;

    @RequestMapping("/back/newsType/findAll")
    public ResultDTO findAll(NewsTypeModel newsType) {
        ResultDTO resultDTO = newsTypeService.findAll(newsType);
        return resultDTO;
    }


    @RequestMapping("/back/newsType/add")
    public ResultDTO add(NewsTypeModel newsType) {
        ResultDTO resultDTO = newsTypeService.add(newsType);
        return resultDTO;
    }



    @RequestMapping("/back/newsType/delete")
    public ResultDTO delete(Long id) {
        ResultDTO resultDTO = newsTypeService.delete(id);
        return resultDTO;
    }


    @RequestMapping("/back/newsType/findById")
    public ResultDTO findById(Long id) {
        ResultDTO resultDTO = newsTypeService.findById(id);
        return resultDTO;
    }

    @RequestMapping("/back/newsType/findNewsTypeById")
    public NewsTypeModel findNewsTypeById(Long id) {
        NewsTypeModel newsTypeById = newsTypeService.findNewsTypeById(id);
        return newsTypeById;
    }


    @RequestMapping("/back/newsType/update")
    public ResultDTO update(NewsTypeModel newsType) {
        ResultDTO resultDTO = newsTypeService.update(newsType);
        return resultDTO;
    }



}
